﻿#pragma once

#include "../../MirControls/MirImageControl.h"
#include "../../../Shared/Data/ItemData.h"
#include "../../MirControls/MirControl.h"
#include "../../MirControls/MirLabel.h"
#include <string>
#include <vector>

//C# TO C++ CONVERTER NOTE: Forward class declarations:
namespace Client::MirScenes::Dialogs { class ItemRow; }

using namespace Client::MirControls;
using namespace Client::MirGraphics;
using namespace Client::MirSounds;
using namespace Client::MirNetwork;

namespace C = ClientPackets;

namespace Client::MirScenes::Dialogs
{
    class ItemRentalDialog final : public MirImageControl
    {
    private:
        const std::vector<ItemRow*> _itemRows = std::vector<ItemRow*>(3);
        DateTime _lastRequestTime = DateTime::Now;

    public:
        ItemRentalDialog();

        void Toggle();

        void ReceiveRentedItems(std::vector<ItemRentalInformation*> &rentedItems);

    private:
        void RequestRentedItems();

    private:
        class ItemRow final : public MirControl
        {
        private:
            MirLabel *const _itemNameLabel, *const _rentingPlayerLabel, *const _returnDateLabel;

        public:
            virtual ~ItemRow()
            {
                delete _itemNameLabel;
                delete _rentingPlayerLabel;
                delete _returnDateLabel;
            }

            ItemRow();

            void Clear();

            void Update(const std::string &itemName, const std::string &rentingPlayerName, const std::string &returnDate);
        };
    };
}
